<!--
 * @Author: your name
 * @Date: 2020-05-26 09:48:34
 * @LastEditTime: 2020-05-28 11:37:59
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \tuyibo\admin\src\components\account\userList.vue
--> 

<template>
  <div>
    <el-table :data="tableData" border style="width: 100%;margin-top:10px;">
      <el-table-column prop="id" label="id"></el-table-column>
      <el-table-column prop="nickname" label="昵称"></el-table-column>
      <el-table-column prop="avatar" label="头像"></el-table-column>
      <el-table-column prop="sex" label="性别"></el-table-column>
      <el-table-column prop="about_me" label="关于用户"></el-table-column>
      <el-table-column prop="last_seen" label="最后登录"></el-table-column>
      <el-table-column prop="register_ip" label="注册IP"></el-table-column>
      <el-table-column prop="register_date" label="注册日期"></el-table-column>
      <el-table-column prop="score" label="积分"></el-table-column>
      <el-table-column prop="praises_hit" label="点赞次数"></el-table-column>
      <el-table-column prop="downloads" label="下载次数"></el-table-column>
    </el-table>
    <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :page-sizes="[5, 10, 15, 20, 25, 30]"
          :page-size="queryData.pagesize"
          :pager-count="7"
          layout="sizes, prev, pager, next,jumper, ->,total"
          :total="count"
        ></el-pagination>
  </div>
</template>

<script>
export default {
  data() {
    return {
      queryData:{
        page:1,
        pagesize:15
      },
      count:0,
      tableData: []
    };
  },
  mounted(){
    this.getUserList(this.queryData)
  },
  methods:{
      handleCurrentChange(val) {
      this.queryData.page = val;
      this.getUserList(this.queryData);
    },

    handleSizeChange(val) {
      this.queryData.pagesize = val;
      this.getUserList(this.queryData);
    },
    getUserList(data){
      this.axios.post('/user/getUserList',data)
      .then(res=>{
        this.count=res.count
        this.tableData=res.rows
      })
      .catch(err=>{
        console.log(err)
      })
    }
  }
};
</script>

<style lang="scss" scoped>
</style>
